/**
 * Created by Aber on 17/3/23.
 */
// 加载模块
module.exports = function(ngModule) {
    require('./user.scss');

    ngModule.directive('user',function () {
        return {
            restrict: 'E',//元素(element)
            scope: {},
            replace: true,
            template: require('./user.html'),//模板
            controllerAs: 'user',// <=> $scope.vm = {greeting: '你好，我是卡哥'}
            controller: function ($scope) {
                $scope.teamFen=function () {
                    //自定页
                        layer.open({
                            type: 2,
                            title: '邀请团队成员二维码和选择团队',
                            shadeClose: true,
                            shade: 1,
                            area: ['70%', '90%'],
                            content: location.origin+"/webpack/src/pages/layer/aoQing.html",
                            end:function () {
                                var img =document.getElementById("user_pciture");
                                img.style.backgroundImage="url("+JSON.parse(sessionStorage.user).picture+")"
                            }
                        });
                };
                var img =document.getElementById("user_pciture");
                img.style.backgroundImage="url("+JSON.parse(sessionStorage.user).picture+")";
                $scope.title=JSON.parse(sessionStorage.user).title;
                $scope.setUser=function () {
                    //页面层
                    layer.open({
                        type: 2,
                        title: '用户设置',
                        shadeClose: true,
                        shade: 1,
                        area: ['70%', '90%'],
                        content: location.origin+"/webpack/src/pages/layer/setUser.html",
                        end:function () {
                            var img =document.getElementById("user_pciture");
                            img.style.backgroundImage="url("+JSON.parse(sessionStorage.user).picture+")";
                            $scope.title=JSON.parse(sessionStorage.user).title;
                        }
                    });
                }
            }
        }
    });//定义指令，对应页面中的<hello-world></hello-world>
}